package com.jly.vos;

import lombok.Data;

import java.io.Serializable;
@Data
public class ApiResult<T> implements Serializable {
    public static ApiResult success() {
        return new ApiResult(true, "200", "success");
    }

    public static <T> ApiResult<T> success(T data) {
        return new ApiResult<>(true, "200", "success", data);
    }

    public static ApiResult fail(String message) {
        return new ApiResult(false, "500", message);
    }

    public ApiResult() {}

    public ApiResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public ApiResult(Boolean success, String code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    public ApiResult(Boolean success, String code, String message, T data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    
    private static final long serialVersionUID = -2402122704294916086L;

    private Boolean success = Boolean.TRUE;
    private String code;
    private String message;
    private T data;

}